package schema

import (
	"entgo.io/ent"
	"entgo.io/ent/schema/edge"
	"entgo.io/ent/schema/field"
)

// OrderDetail holds the schema definition for the OrderDetail entity.
type OrderDetail struct {
	ent.Schema
}

// Fields of the OrderDetail.
func (OrderDetail) Fields() []ent.Field {
	return []ent.Field{
		field.Int64("id"),
		field.Int64("product_id"),
		field.String("product_name"),
		field.Int64("product_num"),
	}
}

// Edges of the OrderDetail.
func (OrderDetail) Edges() []ent.Edge {
	return []ent.Edge{
		edge.From("owner", Order.Type).Ref("details").Unique(),
	}
}
